<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>医师审核</title>
    <?php PrintPageHead(); ?>
    <link href="../resource/css/hermes.css" rel="stylesheet">
    <link href="../resource/js/calendar/calendar-blue.css" type="text/css" rel="stylesheet">
    <script src="../resource/js/calendar/calendar.js" type="text/javascript"></script>
    <script src="../resource/js/hermes.js"></script>
    <style type="text/css">
        .divleft{width: 12%; float: left; text-align:left; border-right: solid 1px #d5d5d5; margin-right: 2% }
        .divcenter{width: 12%; float: left; text-align:left; border-right: solid 1px #d5d5d5; margin-right: 2%}

        .divright{ width: 12%; float: left; text-align:left;  margin-right: 2%}
        .position {
            position: absolute;
            display: none;
            z-index: 15;
            width: 400px;
            height: 40px;
            margin: -20px 0 0 -75px;
            padding: 0 10px;
            background: #eee;
            line-height: 2.4;
            cursor:pointer;
        }
    </style>
    <?php
    if (!array_key_exists("公众号ID",$_SESSION)) {
        header("Location:back.php");
    }
    pdo()->beginTransaction();
    $bm=new C后台管理员();
    $act = $_GET['act']==''?1:$_GET['act'];
    $本页面 = 'back.php?state=back9check';
    $未认证医师列表=$bm->get未认证医师列表($act,$_GET['page'],$_GET,$_POST['keywords']);
    if($_POST['状态']) {
        $医师详情id = $_POST['医师详情id'];
        unset($_POST['医师详情id']);
        $sql = "select a.用户id,b.认证 from 医师详情 as a left join 用户 as b on a.用户id = b.id where a.id= $医师详情id";
        $用户id = pdo()->selectOne($sql);
        if( $用户id['认证']!='2'){
            if($_POST['状态'] == '通过'){
                $认证 = pdo()->update('用户',array('认证'=>'3','更新缓存'=>'是'),array('id'=>$用户id['用户id']));
            }
            if($_POST['状态'] == '待审核'  ){
                $认证 = pdo()->update('用户',array('认证'=>'1','更新缓存'=>'是'),array('id'=>$用户id['用户id']));
            }
            if($_POST['状态'] == '未通过' ){
                $认证 = pdo()->update('用户',array('认证'=>'1','更新缓存'=>'是'),array('id'=>$用户id['用户id']));
            }
        }
        $医师详情 = pdo()->update('医师详情',$_POST,array('id'=>$医师详情id));
        header("location:".$本页面);
    }
    pdo()->commit();
    ?>
</head>
<body>


<div class="container-fluid">
    <?php include_once 'back_header.php'; ?>
    <div class="panel panel-primary">
        <div class="panel-heading text-center"><h3 class="panel-title">医师审核</h3></div>
        <div class="panel-body" style="text-align:center">
            <div style="margin: 0 0 10px 0;text-align:left"><b style="color:#3c763d;font-size: 16px;">姓名查询</b><br/>
                <form action="" method="post">
                    <input type="text" name="keywords" value="<?=$_POST['keywords']?>">&nbsp;&nbsp;
                    <button type="submit"  class="btn btn-default btn-success ">&nbsp;查 询&nbsp;</button></form></div>
            <div style="width: 100%; text-align:right">
                <a href="<?=$本页面?>&act=1" id="daishen">待审核</a>
                <a href="<?=$本页面?>&act=2" id="weit">未通过</a>
                <a href="<?=$本页面?>&act=3" id="tongg">通过</a>
            </div>
            <div class="panel-group"  id="accordion" role="tablist" aria-multiselectable="true">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <div class="row" style="">
                          <div class="divleft">
                                头像
                            </div>
                            <div class="divcenter">
                                姓名
                            </div>
                           
                            <div class="divcenter">
                                医院
                            </div>
                           
                            <div class="divcenter">
                                区域
                            </div>
                            <div class="divcenter">
                                医师资格证
                            </div>
                            <div class="divcenter">
                                个人简介
                            </div>
                            <div class="divright">
                                操作
                            </div>
                        </div>
                    </div>
                </div>
                <?php foreach($未认证医师列表['result'] as $v){?>
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <div class="row">
                                <div class="divleft">
                                    <?php
                                   // $sql = "select 头像 from 用户 where id = {$v['用户id']}";
                                  //  $头像=pdo()->selectOne($sql);
                                    ?>
                                    <img src="<?=$v['头像']?>" width="80%"  id="" style="cursor:pointer" class="fun"/>
                                    <div class="position" >
                                        <img src="<?=$v['头像']?>" width="100%" id="" class="fun1"/>
                                    </div>
                                </div>
                                <div class="divcenter" style="cursor:pointer" >
                                    <div class="fun"><?php echo mb_substr($v['name'],0,5,'utf-8').'...'?></div>
                                    <div  class="position" class="">
                                        <div class="fun1" style="background: #e2ebf3;color:#000000"><?=$v['name']?></div>
                                    </div>
                                </div>
                              
                                <div class="divcenter" style="cursor:pointer" >
                                    <div class="fun"><?php echo mb_substr($v['医院'],0,5,'utf-8').'...'?></div>
                                    <div  class="position" class="">
                                        <div class="fun1" style="background: #e2ebf3;color:#000000"><?=$v['医院']?></div>
                                    </div>
                                </div>
                               
                                <div class="divcenter" style="cursor:pointer" >
                                    <div class="fun"><?php echo mb_substr($v['区域'],0,5,'utf-8').'...'?></div>
                                    <div  class="position" class="">
                                        <div class="fun1" style="background: #e2ebf3;color:#000000"><?=$v['区域']?></div>
                                    </div>
                                </div>
                                <div class="divcenter" >
                                    <img src="<?=$v['照片']?>" width="20%" class="fun" style="cursor:pointer"/>
                                    <div  class="position">
                                        <img src="<?=$v['照片']?>" width="100%" class="fun1"/>
                                    </div>
                                </div>
                                <div class="divcenter" style="cursor:pointer" >
                                    <div class="fun"><?php echo mb_substr($v['简介'],0,5,'utf-8').'...'?></div>
                                    <div  class="position" class="">
                                        <div class="fun1" style="background: #e2ebf3;color:#000000"><?=$v['简介']?></div>
                                    </div>
                                </div>
                                <div class="divright">
                                    <form action="" method="post" name="form">
                                        <select class="status" name="状态">
                                            <option value="">请选择</option>
                                            <option value="通过" <?php if($v['状态']=='通过')echo selected; ?>>通过</option>
                                            <option value="未通过"<?php if($v['状态']=='未通过')echo selected; ?>>未通过</option>
                                            <option value="待审核"<?php if($v['状态']=='待审核')echo selected; ?>>待审核</option>
                                        </select>
                                        <input class="con" type="button" value="确认"/>
<!--                                        <input type="hidden" name="医师详情id" value="--><?//=$v['id']?><!--"/>-->
                                    </form>
                                </div>
                                </div>

                            </div>
                        </div>

                <?php }
                if(!$未认证医师列表['result']){
                ?>
                <div class="panel-heading text-center"><h3 class="panel-title">没有数据 !!!</h3></div>
                <?php }?>
            </div>
            <?=$未认证医师列表['show']?>
        </div>

    </div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="../resource/js/jquery-1.11.1.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="../resource/js/bootstrap.min.js"></script>
<script language="JavaScript">
    $(function(){
        $(".con").click(function(){
            //var 状态 = $(".status option:selected").val();

            var 状态 = $('.status').val();
            alert(状态);
            $.post('back9check.php',{'状态':状态,'医师详情id':<?=$v['id']?>},function(data){

            }) ;
        })

        $(".funner").click(function(){
            $(this).next("div").show();
        })

        $(".fun").click(function(){

            $(this).next("div").show();
        })
        $(".fun1").click(function(){
            $(this).parent("div").hide();
        })
        switch(<?=$_GET['act']?>){
            case 1:
                $("#daishen").css("color","red");
                break;
            case 2:
                $("#weit").css("color","red");
                break;
            case 3:
                $("#tongg").css("color","red");
                break;
        }
    })

</script>
</body>
</html>